package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 浦发入金通知信息表
 */
@TableName("t_spd_bank_notice")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.SpdBankNoticeMapper")
public class SpdBankNotice extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 请求日期
     */
    @TableField(value = "notice_date")
    private String noticeDate;

    /**
     * 请求时间
     */
    @TableField(value = "notice_time")
    private String noticeTime;

    /**
     * 请求类型
     */
    @TableField(value = "notice_type")
    private String noticeType;

    /**
     * 请求流水号
     */
    @TableField(value = "notice_ser_no")
    private String noticeSerNo;

    /**
     * 交易地区代码
     */
    @TableField(value = "zone_code")
    private String zoneCode;

    /**
     * 服务商代码
     */
    @TableField(value = "secu_no")
    private String secuNo;

    /**
     * 服务商名称
     */
    @TableField(value = "secu_name")
    private String secuName;

    /**
     * 商户代码
     */
    @TableField(value = "merch_no")
    private String merchNo;

    /**
     * 商户名称
     */
    @TableField(value = "merch_name")
    private String merchName;

    /**
     * 母账户账号
     */
    @TableField(value = "parent_acct_no")
    private String parentAcctNo;

    /**
     * 母账户户名
     */
    @TableField(value = "parent_acct_name")
    private String parentAcctName;

    /**
     * 资金监管交易流水号
     */
    @TableField(value = "dep_ser_no")
    private String depSerNo;

    /**
     * 核心交易流水号
     */
    @TableField(value = "core_ser_no")
    private String coreSerNo;

    /**
     * 核心交易日期 yyyyMMdd
     */
    @TableField(value = "core_trans_date")
    private String coreTransDate;

    /**
     * 核心交易时间  HHmmss
     */
    @TableField(value = "core_trans_time")
    private String coreTransTime;

    /**
     * 资金监管交易日期 yyyyMMdd
     */
    @TableField(value = "trans_date")
    private String transDate;

    /**
     * 资金监管交易时间 HHmmss
     */
    @TableField(value = "trans_time")
    private String transTime;

    /**
     * 业务类型
     */
    @TableField(value = "busi_type")
    private String busiType;

    /**
     * 交易金额 单位元 yyyyMMdd
     */
    @TableField(value = "trans_amt")
    private String transAmt;

    /**
     * 来账账户行名
     */
    @TableField(value = "acct_bank_name")
    private String acctBankName;

    /**
     * 来账账户行号
     */
    @TableField(value = "acct_bank_no")
    private String acctBankNo;

    /**
     * 来账户名
     */
    @TableField(value = "acct_name")
    private String acctName;

    /**
     * 来账账号
     */
    @TableField(value = "acct_no")
    private String acctNo;

    /**
     * 附言 包含标段编号
     */
    @TableField(value = "attach")
    private String attach;

    /**
     * 备注1
     */
    @TableField(value = "remark1")
    private String remark1;

    /**
     * 备注2
     */
    @TableField(value = "remark2")
    private String remark2;

    /**
     * 备注3
     */
    @TableField(value = "remark3")
    private String remark3;

    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 关联处理的受理订单号
     */
    @TableField(value = "accept_order_no")
    private String acceptOrderNo;

    /**
     * 记账子单元编号
     */
    @TableField(value = "sub_account")
    private String subAccount;

    public SpdBankNoticeVo buildVo() {
        return new SpdBankNoticeVo(id, noticeDate, noticeTime, noticeType, noticeSerNo, zoneCode, secuNo, secuName, merchNo, merchName, parentAcctNo, parentAcctName, depSerNo, coreSerNo, coreTransDate, coreTransTime, transDate, transTime, busiType, transAmt, acctBankName, acctBankNo, acctName, acctNo, attach, remark1, remark2, remark3, gmtCreate, gmtModified, acceptOrderNo,subAccount);
    }

    public static SpdBankNotice of(SpdBankNoticeVo vo) {
        return new SpdBankNotice(vo.getId(), vo.getNoticeDate(), vo.getNoticeTime(), vo.getNoticeType(), vo.getNoticeSerNo(), vo.getZoneCode(), vo.getSecuNo(), vo.getSecuName(), vo.getMerchNo(), vo.getMerchName(), vo.getParentAcctNo(), vo.getParentAcctName(), vo.getDepSerNo(), vo.getCoreSerNo(), vo.getCoreTransDate(), vo.getCoreTransTime(), vo.getTransDate(), vo.getTransTime(), vo.getBusiType(), vo.getTransAmt(), vo.getAcctBankName(), vo.getAcctBankNo(), vo.getAcctName(), vo.getAcctNo(), vo.getAttach(), vo.getRemark1(), vo.getRemark2(), vo.getRemark3(), vo.getGmtCreate(), vo.getGmtModified(), vo.getAcceptOrderNo(),vo.getSubAccount());
    }
}
